UICS Communication Driver

 

UICS is the driver to communicate with Component Sequencing System of Universal Instruments Corporation, in America.

 

1. Read settings

 

<Figure 1> is read setting example of UICS communication driver.

 
<Figure 1> Read setting example of UICS communication driver
 

Device Setting of <Figure 1> are input, Com Port(COM1), Com Baud(9600), Parity Bit(0), Data Bit(8), Stop Bit(1).

Also, you can input Start Address( 0 ) of String Memory Save Position to save read communication data, Old Read Data Save Length ( 200 ), Read Delimiter( 0 = CR + LF,  1 = CR ), Send Delimiter ( 0 = CR, 1 = CR+LF, 2 = None ), Communication Code Save To File( 1 = Save, 0 = Not save ), Save File name( just input the name ) and Read Delimiter end code (Default =3), by separating as comma. Default value (in case of there is no input) is 0, 200, 0, 0, 0 ¡¦.

 

Notice) In case of saving communication data as file, file name is 'WorkDirectory\SCAN\FileName'.

Ex) When Work Directory = c:\testwork and File name = commCodeSave.txt,

file to save communication data is c:\testwork\ commCodeSave.txt.

 

Read Setting Method

 

Read setting needs only single line( READ, ), because UICS communication drive is communicated by digital/analog output.

UICS is equipment to get operating information by communicating as ASCII type.

Therefore, UICS communication drive makes store the character(ASCII) data which communicate with device to designated address of String memory, as following order.

 

<Figure 2> Option dialog box of UICS communication drive

Error/Completion status bit

Error status of UICS communication drive and completion status such as DOWNLOAD, EXEDOWNLOAD and UPLOAD, etc are saved to memory such as <Table 1>.

Also, result of contents for incurred error/status are stored at c:\error_msg000.txt file.

Contents Position Address when set digital input tag
Various error First bit of WORD memory 0000
Completion of DOWNLOAD/UPLOAD etc Second bit of WORD memory 0001
<Table 1> Meaning and contents for error/completion status by bit

Notice) In case of Error/Completion status bit, communication drive always ON so you have to OFF after reading error status at LocalMain, if you want to read Error/Completion contents to occur next.

 

Method for letting OFF the memory of communication program forcedly) If you set Extra1 of Digital/Analog output tag as #mem#, you can let OFF designated communication memory address value.

 

2. Write settings

Write to direct address of controller, regardless of SCAN File.

 

Digital Write

You can deliver read/write command to device by using digital output.

 

Digital write setting parameters are as follows :

1) PORT : Connected Port number which is set at communication program.(It isn't number such as COM1 and COM2 etc)

2) STATION : Don't care.

3) Address : In case of SH_M, SET_C, ST_READ, AN_MA_AL and AN_BO_AL command - Memory address to save read data.

CLR_DATA – Start address of String memory to clear.

Etc – Don't care.

4) Extra1 : Command. Designated unique command at UICS device and designated command at communication drive(Refer to <Table 2>).

UICS unique command – NAMES, SH Q, etc.

Specified command of communication drive - CMD_FILE, DOWNLOAD, EXEDOWNLOAD, UPLOAD, CLR_DATA, SH_M, SET_C, ST_READ, AN_MA_AL, AN_BO_AL.

(Designate the command as CMD_FILE such as DOWNLOAD, EXEDOWNLOAD and UPLOAD, etc which have many number of letters)

5) Extra2 : UPLOAD command or set communication file data name.

0 : If the designated file exist, don't overwrite when UPLOAD.

1 : If the designated file exist, overwrite when UPLOAD.

9999 : Set communication file data name – File name is Extra1

CLR_DATA – Number of String memory to clear.

Etc command : Don't care.

Command Unique command

Function

Remarks

CMD_FILE -

C:\cmd_file%03d.txt (%03d is Port number)

recognize as command by reading contents of first line

When length of command(designate unique and drive) is too long, can't send contents to Extra1 parameter

DOWNLOAD IN

Send file contents which is input next to command to UICS

DOWNLOAD 1.TXT  (1.TXT is WorkDirectory\DATA Directory)

EXEDOWNLOAD -

Send EXE file which is input next to command to UICS

EXEDOWNLOAD EXE\AC32C.LDA  (AC32C.LDA is WorkDirectory\DATA\EXE Directory)

UPLOAD OUT

Input 2 file names next to command. First file name is input at UICS, second thing is file name to save UPLOADed data

UPLOAD 1.TXT UP\UP123.TXT  (UP123.TXT is WorkDirectory\DATA\UP Directory)

CLR_DATA -

Delete the data upto the number of specified data(Extra2) from designated String memory(Address)

String memory is possible only.

SH_M SH
M

Save string of current operating file to designated STRING address

Save only to String memory.

SET_C SET
C

Save target amount and current value as string and number, to designated STRING, WORD, FLOAT and DWORD address.

Save to entire memory of WORD, FLOAT, DWORD and STRING by classifying the read data

(Save string to String memory, in order)

ST_READ ST

Save status of run/stop and status of string to designated STRING and WORD address

AN_MA_AL AN
MA
AL

Save run, ready,... as string and number, to designated STRING, WORD, FLOAT and DWORD address

AN_BO_AL AN
BO
AL

Save run, ready,... as string and number, to designated STRING, WORD, FLOAT and DWORD address

<Table 2> Functional description of designated command at communication drive

Write example 1)

Port : 0  Station : 0  Address : 0000  Extra1 : cmd_file, EXTRA2 : 1

If you set as above and create UPLOAD 1.txt updata\12345.txt at first line of C:\cmd_file000.txt by using script and write the digital value, it save as WorkDirectory\data\updata\12345.txt by reading 1txt file of UICS device which is connected to Port no.0. (If 12345.txt file exist, overwrite it)

 

Write example 2)

Port : 0  Station : 0  Address : 0251  Extra1 : SH_M, EXTRA2 : Blank

If you set as above and write digital value, it reads current operating file of UICS device which is connected Port no.0, and save it from no.251 String memory. (If operation data of read device is more than 2, it store to 251, 251, ¡¦ , etc as in memory order) 

 

Write example 3)

Port : 0  Station : 0  Address : 0260  Extra1 : an_ma_al, EXTRA2 : Blank

If you set as above and write digital value, it reads run, ready, etc data of UICS device which is connected Port no.0, and save each data to WORD, FLOAT and DWORD memory from no.260 to no.281 by calculating as number, and it store read string to String memory from no.260 address.

 

Write example 4)

Port : 0  Station : 0  Address : 0000  Extra1 : names, EXTRA2 : Blank

If you set as above and write digital value, it saves communicated contents by sending NAMES unique command of UICS device which is connected to Port no.0, to String memory.

 

Analog Write

It is same setting with Digital Write.

 

3. Method for terminal screen at LocalMain

UICS communication drive store most of communicated data to String memory, so you can confirm status of device by using the terminal mode, as follows.

 

A)   Create String to read input command by user from twenty String tag to show at screen and input method editor(Edit Box) by bringing communication data at String memory

B)   Create digital tag to write command together, and create module screen such as <Figure 3> by using studio program.

<Figure 3> Example of creating terminal screen at module editor(studio)

C)   Create to let see previous command by using button, create the Script On Module Running script such as <Table 3>.

Function

Contents

Create to let see previous command at terminal screen

if(pos == $scroll_pos) return;

pos = $scroll_pos;

 

for(i = 0; i < 20; i = i+1) {

   @sprintf(tag_name, "ST_%02d.address", i);

   @SetTagValue(tag_name, pos+i);

}

<Table 3> Example of creating script to enable to do see previous command

D)   Check( v ) Use Extension Options and Key Down button(Refer to <Figure 4>) by opening Extension tab of input method editor(Edit Box) such as <Figure 3>.

E)   Write Key Down script such as <Table 4> and <Figure 5>.

F)   Also, designate tag( STRING02 : Ex ) to save contents of input method editor at tag tab of input method editor(Edit Box).

G)   If you create module file as above, you can create terminal screen such as <Figure 6>.

<Figure 4> Setting screen of Extension tab for input method editor(Edit Box)
 

Function

Contents

In case of pressing enter key at input method editor (Edit Box), send input contents as command of device

retn = @KeyGetCode();

if(retn != 13) return;    // In case of not enter key, return

 

handle  = @FileOpen("C:\\cmd_file000.TXT", "w");

if(handle != 0) {

   length = @strlen($STRING02);

   if(length == 0)

      @FileWrite(handle, " ", 1);

   else {

      @sprintf(buf, "%s", $STRING02);

      @FileWrite(handle, buf, length);

   }

   @FileWrite(handle, "\r\n");

   @FileClose(handle);

   $DO_EXEC = 0;

}

@EditBoxSetText("EditBox1", "");

<Table 4> Example of writing script to let see previous command

 
<Figure 5> Example of writing Key Down script of input method editor(Edit Box)
 

 
<Figure 6> Example of creating terminal screen at LocalMain
 

4. Read data for operation status

 

You can utilize data such as current operating program, production targets, production current situation, current status, etc which are read by UICS communication drive by saving as analog/digital/string tag. And it can be written as follows.

Reading operation status data have to be read when other screen is opened, because in case of executing at terminal screen and DOWNLOAD/EXEDOWNLOAD/UPLOAD screen, more than 2 commands may exist.

 

A)   Create module screen which confirms operation status data.

B)   Create five digital output tag such as type of <Table 5> for reading operation status data.

Tag Name

Address

Extra1

DO_EXEC1

0250

SH_M

DO_EXEC2

0255

SET_C

DO_EXEC3

0260

ST_READ

DO_EXEC4

0270

AN_MA_AL

DO_EXEC5

0300

AN_BO_AL

<Table 5> Example of digital output tag setting(partial) for reading operation status data

C)   Insert program to Script On Module Running such as <Table 6>.

D)   If you create as above module and script and current module file is opened by executing LocalMain, operation status data is read once per minute.

Function

Contents

Read operation status data once per minute

sec = @GetTimeSec();

if(sec == 0) {

  if(flag == TRUE) return;

   flag = TRUE;

   $DO_EXEC1 = 0;

   $DO_EXEC2 = 0;

   $DO_EXEC3 = 0;

   $DO_EXEC4 = 0;

   $DO_EXEC5 = 0;

}

else flag = FALSE;

<Table 6> Example of writing script for reading operation status data once per minute
5. Example of processing error/completion status bit

 

UICS communication drive can be utilized by using no.0000 bit of WORD memory as error status bit and no.0001 bit as completion status bit, as follows.

 

A)   Create digital input tag which reads error/completion status bit.

B)   If you write script such as <Table 7> and <Figure 7> by using At Program Running script, it reads occurred error and display the error at LocalMain as message.

C)   Also, completion message can be processed as same method. 

Function

Contents

Display message at LocalMain by reading occurred error status bit

if($err_check == OFF) {

   flag = OFF;

   return;

}

if(flag == ON) return;

 

handle  = @FileOpen("C:\\error_msg000.txt", "r");

if(handle == 0) return;

 

len = @FileRead(handle, buf, 79);

@FileClose(handle);

 

buf[len] = 0;

@Message(buf);

flag = ON;

$err_flag_clear1 = OFF;

<Table 7> Example of writing script for displaying message at LocalMain by reading occurred error status bit

 
<Figure 7> Example of writing script for displaying message at LocalMain by reading occurred error status bit